const CompressionPlugin = require('compression-webpack-plugin');

// vue.config.js
module.exports = {
  publicPath: process.env.NODE_ENV === 'production' ? '/okr/' : '/',
  configureWebpack: config => {
    if (process.env.NODE_ENV === 'production') {
      return {
        plugins: [
          new CompressionPlugin({
            test: /\.js$|\.html$|\.css$/, //匹配文件名
            threshold: 10240, //对超过10k的数据压缩
            deleteOriginalAssets: false //不删除源文件
          })
        ]
      };
    }
  },
  devServer: {
    proxy: {
      '/dev': {
        target: 'http://suhao.online:8001/',
        changeOrigin: true,
        pathRewrite: {
          '^/dev': ''
        }
      }
    }
  }
};
